<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateEvaluateTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		// 这个表格用户对律师咨询的评价
		Schema::create('evaluate', function(Blueprint $table){
			$table->increments('id');
			$table->integer('item_id');	// 评论的对象的id
			$table->integer('creator_id'); // 创建评论的用户的id
			$table->tinyInteger('score'); // 评论分数
			$table->string('comment', 1000)->nullable()->default(''); // 评价的评论
			$table->string('type', 100)->nullable()->default(''); // 评价的类型
            $table->unique(array('item_id', 'creator_id', 'type'));
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
	}

}
